package com.example.ywj.myapplication.AsyncTask;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;

import com.example.ywj.myapplication.R;

public class AsyncTaskActivity extends AppCompatActivity implements View.OnClickListener {
    private Button btn_asyncTack;
    private ProgressBar pb;
    private ImageView iv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_async_task);
        initView();
    }
    public void initView(){
        btn_asyncTack = findViewById(R.id.btn_async);
        btn_asyncTack.setOnClickListener(this);
        pb = findViewById(R.id.progressbar);
        iv = findViewById(R.id.async_tv);
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btn_async:
                new DownloadTask(pb,iv).execute();
                break;
        }
    }
}
